package com.briup.cms.web.controller;

import com.briup.cms.bean.BaseUser;
import com.briup.cms.utils.JwtUtil;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description
 * @Author lining
 * @Date 2021/7/17 16:57
 * @Version 1.0.0
 */
@RestController
@RequestMapping("/auth/user")
public class UserController {
    @GetMapping("/info")
    public Message getUserInfo(HttpServletRequest request){
        //1.获取token值
        String token = request.getHeader("Authorization");
        System.out.println(token);
        //2.获取用户名
        String username = JwtUtil.getUserId(token);
        System.out.println(username);
        //3.将username传递给service层进行查询，返回BaseUser信息
        BaseUser user = null;
        return MessageUtil.success(user);
    }
    public Message findUserByUserName(){
        return MessageUtil.success();
    }

}
